home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / dev / e / Estuff.lha / e-stuff / rerun / RR_Key.lha / ReRun_key.e < prev   
Text File  |  1980-10-01  |  2KB  |  73 lines

  1. MODULE 'workbench/startup'
  2.  
  3. PROC main()
  4. DEF wb:PTR TO wbstartup, args:PTR TO wbarg
  5. DEF olddir=NIL, string[300]:STRING, fh=NIL
  6. DEF path[200]:STRING, file[200]:STRING
  7. IF wbmessage<>NIL
  8. wb:=wbmessage
  9. args:=wb.arglist
  10. args++
  11. olddir:=CurrentDir(args[].lock)
  12. GetCurrentDirName(string,args[].lock)
  13. AddPart(string,args[].name,300)
  14. sayme()
  15. PrintF(IF script_or_exe(string) THEN 'Running \a\s\a\n' ELSE 'Executing script \a\s\a\n', string)
  16. IF (fh:=Open('SYS:ReRun.tmp',NEWFILE))
  17. Write(fh,string,StrLen(string))
  18. Close(fh)
  19. ENDIF
  20. CurrentDir(olddir)
  21. Delay(150)
  22. ColdReboot()
  23. ELSE
  24. IF (fh:=Open('SYS:ReRun.tmp',OLDFILE))
  25. Read(fh,string,300)
  26. Close(fh)
  27. DeleteFile('SYS:ReRun.tmp')
  28. StrCopy(file,FilePart(string))
  29. StrCopy(path,string,StrLen(string)-StrLen(PathPart(string)))
  30. PrintF('\s\t\s\n', path, file)
  31. dofile(path,file)
  32. ENDIF
  33. ENDIF
  34. ENDPROC
  35.  
  36. PROC script_or_exe(file:PTR TO LONG)
  37. DEF fh=NIL, string[10]:STRING, exe
  38. IF (fh:=Open(file,OLDFILE))
  39. Read(fh,string,5)
  40. Close(fh)
  41. IF string[3]=$f3 THEN exe:=TRUE ELSE exe:=FALSE
  42. ENDIF
  43. ENDPROC exe
  44.  
  45. PROC dofile(path,file)
  46. DEF lock, olddir=NIL, command[200]:STRING
  47. sayme()
  48. IF (lock:=Lock(path,-2))
  49. olddir:=CurrentDir(lock)
  50. IF script_or_exe(file)=TRUE
  51. PrintF('Running \a\s\a\n', file)
  52. StringF(command,'"\s"', file)
  53. Execute(command,0,stdout)
  54. PrintF('\nPress mouse button.\n')
  55. ELSE
  56. PrintF('Executing script \a\s\a\n', file)
  57. StringF(command,'Execute "\s"', file)
  58. Execute(command,0,stdout)
  59. PrintF('\nPress RETURN.\n')
  60. ENDIF
  61. CurrentDir(olddir)
  62. UnLock(lock)
  63. ENDIF
  64. ReadStr(IF stdin THEN stdin ELSE stdout,command)
  65. -> WHILE Mouse()=%000
  66. -> ENDWHILE
  67. PrintF('Rebooting!\n')
  68. ColdReboot()
  69. ENDPROC
  70.  
  71. PROC sayme() IS PrintF('\c\n\e[1mReRun\e[0m\eDBy Steven Goodgrove\n\n\n', 12)
  72.  
  73. CHAR 0, '$VER:ReRun v1.0', 0